#!/bin/bash

NAME="testlibrary"
DIR=/var/www/TestLibrary
USER=django
GROUP=django
WORKERS=3
BIND=unix:/var/www/run/gunicorn.sock
DJANGO_SETTINGS_MODULE=TestLibrary.settings
DJANGO_WSGI_MODULE=TestLibrary.wsgi
LOG_LEVEL=error

cd $DIR
source ./bin/activate

export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DIR:$PYTHONPATH

exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
  --name $NAME \
  --workers $WORKERS \
  --user=$USER \
  --group=$GROUP \
  --bind=$BIND \
  --log-level=$LOG_LEVEL \
  --log-file=-